package com.hb.game.pk.adpter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hb.game.pk.APP;
import com.hb.game.pk.R;
import com.hb.game.pk.beans.ReceiveHBBean;
import com.hb.game.pk.utils.StringUtils;
import com.hb.game.pk.utils.TimestampUtils;

public class TotalRedListAdpter extends BaseQuickAdapter<ReceiveHBBean.DataBean.ListBean, BaseViewHolder> {
    public TotalRedListAdpter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, ReceiveHBBean.DataBean.ListBean item) {
//        Glide.with(mContext).load(item.getUrl())
//                .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(5, 0, RoundedCornersTransformation.CornerType.ALL)))
//                .into(imageView);
        String time = "";
        if (!StringUtils.isEmpty(item.getRecivetime())) {
            time = item.getRecivetime();
            helper.setText(R.id.tv_time, TimestampUtils.getCurrentTime(Long.parseLong(time) * 1000));
        } else {
            helper.setText(R.id.tv_time, item.getCreatime());
        }
        helper.setText(R.id.tv_name, item.getUser_id());
        helper.setText(R.id.tv_money, (Float.parseFloat(item.getMoney()) / 100f) + "");
    }

    private int getHeadRes(String avatar) {
        int res = R.mipmap.ic_head_normal;
        String trim = StringUtils.getString(avatar);
        if (StringUtils.isEmpty(trim)) {
            res = R.mipmap.ic_head_normal;
        } else {
            if (StringUtils.isNumber(trim)) {
                int i = Integer.parseInt(trim);
                res = APP.headResource.get(i - 1);
            }
        }
        return res;
    }
}
